<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>个人信息</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="小伟后台">
<meta name="description" content="小伟后台">
<meta name="author" content="yinqi">
<link href="../plugin/admin/css/bootstrap.min.css" rel="stylesheet">
<link href="../plugin/admin/css/materialdesignicons.min.css"
	rel="stylesheet">
<link href="../plugin/admin/css/style.min.css" rel="stylesheet">
</head>

<body>
	<div class="container-fluid p-t-15">

		<div class="row">
			<div class="col-lg-12">
				<div class="card">
					<div class="card-body">

						<div class="edit-avatar">
							<img id="Path" src="" alt="！" class="img-avatar">
							<div class="avatar-divider"></div>
							<div class="edit-avatar-content">
								修改图像：<input id="path" type="file" /> <small class="m-0">选择一张你喜欢的图片</small>
							</div>
						</div>
						<hr>
						<form method="post" action="#!" class="site-form">
							<div class="form-group">
								<label for="username">用户名</label> <input type="text"
									class="form-control" name="username" id="username"
									value="adminUser" disabled="disabled" />
							</div>
							<div class="form-group">
								<label for="nickname">昵称</label> <input type="text"
									class="form-control" name="name" id="name" placeholder="输入您的昵称" />
							</div>
							<div class="form-group">
								<label for="email">邮箱</label> <input type="email"
									class="form-control" name="email" id="email"
									aria-describedby="emailHelp" placeholder="请输入正确的邮箱地址">
								<small id="emailHelp" class="form-text text-muted">请保证您填写的邮箱地址是正确的。</small>
							</div>
							<div class="form-group">
								<label for="remark">简介</label>
								<textarea class="form-control" name="remark" id="remark"
									rows="3"></textarea>
							</div>
							<button type="button" class="btn btn-primary" id="updateAdmin">保存</button>
						</form>

					</div>
				</div>
			</div>

		</div>

	</div>

	<script type="text/javascript" src="../plugin/admin/js/jquery.min.js"></script>
	<script type="text/javascript"
		src="../plugin/admin/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../plugin/admin/js/main.min.js"></script>
	<script type="text/javascript">
		$(function() {
			$.ajax({
				url : '../admin/show',
				dataType : "json",
				type : 'POST',
				cache : false,
				success : function(data) {
					//alert(data.id)
					$("#Path").attr('src', data.path);
					$("#name").val(data.name);
					$("#email").val(data.email);
					$("#remark").val(data.sign);
				},
				complete : function() {
					//alert("处理完毕")
				},
				error : function() {
					console.log("服务器暂时不可用")
				}
			});

			$("#updateAdmin").click(function() {
				$.ajax({
					url : '../admin/updateAdminInfo',
					type : 'POST',
					dataType : "json",
					data : {
						name : $("#name").val(),
						email : $("#email").val(),
						sign : $("#remark").val(),
						username : "adminUser"
					},
					success : function(obj) {
						//alert("88888小伟");
						if (obj.result == 1) {
							alert("正在刷新页面，请不要眨眼")
							window.location.reload();
						}
					}
				});

			});
		});
	</script>


</body>
</html>